<html>
<head>
    <style>
@page  {
    size: 40px 40px;
    margin: 0;
    padding:0;
}
body {
    background-color:red;
}
</style>
</head>
<body>
<div>a<img src=""/>b</div>
</body>
</html>